/**************************************************************************************** 

 ****************************************************************************************/
package cn.js189.uqc.domain.qry;

import cn.js189.uqc.service.IQryPageInfo;
import cn.js189.uqc.common.QryPageInfoDefaultImpl;
import cn.js189.uqc.common.RequestParamBase;
import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/** 
 * <Description> <br> 
 *  
 * @author yangyang<br>
 * @version 1.0<br>
 * @taskId <br>
 * @CreateDate 2018年11月20日 <br>
 */

public abstract class QryAdslProdInstBase extends RequestParamBase {

 // 日志组件
    private static final Logger LOGGER = LoggerFactory.getLogger(QryAdslProdInstBase.class);

    // svcCode 提供的API接口名称
    public static final String BSS_TCP_CONT_SVC_CODE = "js.intf.qryAdslProdInst";

    // 地区标识
    protected String regionId;
    //手机号
    protected String accNum;
    //证件号
    protected String custCertNbr;
    
 // 分页相关信息的封装
    protected IQryPageInfo qryPageInfo;

    /**
     * 查询销售品信息构造器
     * 
     * @param regionId:地区标识
     */
    public QryAdslProdInstBase(String regionId, String accNum, String custCertNbr) {
        super();
        this.regionId = regionId;
        this.accNum = accNum;
        this.custCertNbr =custCertNbr;
        this.qryPageInfo = new QryPageInfoDefaultImpl();
    }

    @Override
    protected JSONObject generateTcpCont() {
        return super.generateTcpCont(BSS_TCP_CONT_APP_KEY, BSS_TCP_CONT_SVC_CODE, null);
    }

    @Override
    protected JSONObject generateSvcCont() {
        JSONObject authenticationInfo = generateAuthenticationInfo();
        if (null == authenticationInfo) {
            LOGGER.error("generate authenticationInfo failure");
            return null;
        }

        JSONObject requestObject = generateRequestObject();
        if (null == requestObject) {
            LOGGER.error("generate requestObject failure");
            return null;
        }

        JSONObject svcCont = new JSONObject();
        svcCont.put("authenticationInfo", authenticationInfo);
        svcCont.put("requestObject", requestObject);
        return svcCont;
    }

    /**
     * 生成 svcCont 下的认证信息
     * 
     * @return
     */
    protected JSONObject generateAuthenticationInfo() {
        return super.generateSvcContAuthenticationInfo(regionId, null, null, null);
    }

    /**
     * 生成 svcCont 下的请求对象
     * 
     * @return
     */
    protected JSONObject generateRequestObject() {
        JSONObject requestObject = new JSONObject();
        requestObject.put("regionId", regionId);
        if(!accNum.equals("")){
            requestObject.put("accNum", accNum);
        }
        if(!custCertNbr.equals("")){
            requestObject.put("custCertNbr", custCertNbr);
        }
        requestObject.put("pageInfo", qryPageInfo.generatePageInfos());
        return improveRequestObject(requestObject);
    }

    /**
     * 补齐 svcCont 下的请求对象
     * 
     * @param requestObject:svcCont下的请求对象
     * @return
     */
    protected abstract JSONObject improveRequestObject(JSONObject requestObject);


   
}
